﻿#region Using Directives

using System;
using System.Text;

#endregion Using Directives

namespace StooRob.SharePoint.ContentUpdater.Utilities
{
    /// <summary>
    /// Collection of string utility methods.
    /// </summary>
    public static class StringUtilities
    {
        /// <summary>
        /// Convert the passed string to a UTF8 byte array.
        /// </summary>
        /// <param name="value">The string to convert to a UTF 8 byte array.</param>
        /// <returns>Array of Byte objects.</returns>
        public static Byte[] StringToUTF8ByteArray(string value)
        {
            Byte[] byteArray = null;

            if (!string.IsNullOrEmpty(value))
            {
                UTF8Encoding encoding = new UTF8Encoding();
                byteArray = encoding.GetBytes(value);
            }

            return byteArray;
        }
    }
}
